<?php
/**
 * szk 2022/7/17
 * 前台优惠券类
 */
namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use App\Models\StoreCouponUser;
use App\Repository\RepositoryInterface\CouponInterface;
use Illuminate\Http\Request;

class DiscountCouponController extends Controller
{
    protected $storeCoupon;

    public function __construct(CouponInterface $storeCoupon)
    {
        $this->storeCoupon = $storeCoupon;
    }

    /**
     * szk
     * 用户使用优惠券
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function checkStatus(Request $request)
    {
        $discountData = $request->post();
        return $this->storeCoupon->checkStatus($discountData);
    }

    /**
     * 根据商品获取优惠券
     * @param $id
     * @return mixed
     */
    public function productDiscount($id)
    {
        return $this->storeCoupon->productDiscount($id);
    }



}
